Cope with -1 eventchn_fd -- this occurs when using --no-domain-init (a
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Fri, 10 Feb 2006 02:23:36 +0000 (03:23 +0100)
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Fri, 10 Feb 2006 02:23:36 +0000 (03:23 +0100)
command line debugging option).

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/xenstore/xenstored_core.c

index 82080ee70e90f72bf7979687abd19de8bd7a2c7e..2dbcaced5d037adddce7f0c1543a1cedafd3b022 100644 (file)
@@ -339,6 +339,8 @@ static int destroy_conn(void *_conn)
 
 static void set_fd(int fd, fd_set *set, int *max)
 {
+       if (fd < 0)
+               return;
        FD_SET(fd, set);
        if (fd > *max)
                *max = fd;
@@ -1670,7 +1672,7 @@ int main(int argc, char *argv[])
                if (FD_ISSET(*ro_sock, &inset))
                        accept_connection(*ro_sock, false);
 
-               if (FD_ISSET(eventchn_fd, &inset))
+               if (eventchn_fd > 0 && FD_ISSET(eventchn_fd, &inset))
                        handle_event();
 
                list_for_each_entry(i, &connections, list) {